package keyboard;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import javax.swing.JFrame;


public class keyboardInput extends KeyAdapter{
	public void keyPressed(KeyEvent e){
		int keyCode = e.getKeyCode();
		switch(keyCode){
		case KeyEvent.VK_LEFT :
			System.out.println("Press Left"); break;
		case KeyEvent.VK_RIGHT:
			System.out.println("Press Right");break;
		case KeyEvent.VK_UP:
			System.out.println("Press up");break;
		case KeyEvent.VK_DOWN:
			System.out.println("Press Down");break;
		default:
			System.out.println("fault press");break;
		}
	}
	
	public void displayKeyboardInput(){
		
		JFrame frame = new JFrame();
		frame.setVisible(true);
		frame.setSize(100,50);
		frame.addKeyListener(new keyboardInput());
	}
	
	public static void main(String args[]){
		
		new keyboardInput().displayKeyboardInput();	
	}
}